//
//  DetailActivityViewController.m
//  haolaDoc
//
//  Created by chen on 2017/5/12.
//  Copyright © 2017年 deyi. All rights reserved.
//

#import "DetailActivityViewController.h"
#import "ScheduleModel.h"
@interface DetailActivityViewController ()

@end

@implementation DetailActivityViewController

- (void)viewDidLoad {
    
    
    [super viewDidLoad];
    _detailScrollView.contentSize=CGSizeMake(0, self.view.frame.size.height);
    [self loadData];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)loadData{
    self.startTimeField.text=self.startTime;
    self.endTimeField.text=self.endTime;
    self.titleField.text=self.scheduleTitle;
    self.placeField.text=self.place;
    self.explainField.text=self.explain;
    [self.startTimeField setEnabled:NO];
    [self.endTimeField setEnabled:NO];
    [self.titleField setEnabled:NO];
    [self.placeField setEnabled:NO];
    [self.explainField setEnabled:NO];
}
/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */
-(void)initData:(ScheduleModel*)scheduleModel{
    NSTimeInterval time=[scheduleModel.startTime doubleValue]/1000;
    NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"MM月dd日HH时mm分"];
    NSString *startTimeStr=[formatter stringFromDate:detaildate];
    self.startTime=startTimeStr;
    time=[scheduleModel.endTime doubleValue]/1000;
    detaildate=[NSDate dateWithTimeIntervalSince1970:time];
    NSString *endTime=[formatter stringFromDate:detaildate];
    self.endTime=endTime;
    self.scheduleTitle=scheduleModel.title;
    self.place=scheduleModel.place;
    self.explain=scheduleModel.explain;
    
}
@end
